%&LaTeX

% A test file for the hyperref and color packages.

\documentclass[12pt]{article}

\usepackage{color}
\usepackage{hyperref}

% The default hyperref options are: 
%   noraiselinks,nobreaklinks,nocolorlinks,noplainpages,
%   nonesting,hyperindex,nohyperfigures,pageanchor

\input oztex.tex   % for \OzTeX

\begin{document}

\thispagestyle{empty}
\parindent=0pt

{\huge Test file for hyperref and color.}

\vskip 1in

\tableofcontents

\parskip=20pt


\newpage

\section{Hyper\TeX\ tests}

\subsection{A subsection}

See color section~\ref{color-sec}.

\subsection{Yet another subsection}

See background section on page~\pageref{bg-sec}.

Here's some nasty links and targets.

\leavevmode
\hyperlink{subsection.1.2}{This link has a
\hypertarget{t1}{target}            % get extra space if nonesting
in the middle.}
Note that an extra space occurs after the target; this can
be removed by using hyperref's ``nesting'' option.

\leavevmode
\hypertarget{t2}{This target has a
\hyperlink{subsection.1.2}{link}    % ok (no extra space)
in the middle.}

Links of different sizes:
{\tiny \hyperlink{subsection.1.2}{[tiny]}}
{\huge \hyperlink{subsection.1.2}{[huge]}}

\hangindent=20pt\hangafter=3
Here's a link that spans a line break:
\hyperlink{this link has no target}{This is a
very very very very very very very very very very
long link.}
And here's an even longer link:
\hyperlink{this link has no target}{This is a
very very very very very very very very very very very very very very
very very very very very very very very very very very very very very
very very very very very very very very very very very very very very
very very very very very very very very very very very very very very
long link.}

And here's a link that spans a page break:
\special{html:<a href="page.3">}This link continues...


\newpage

... this link starts on the previous page,
so is ignored.\special{html:</a>}

\section{Color tests}
\label{color-sec}

Note that colored text is not dithered (nor are colored links).

This sentence should be black.
\textcolor{red}{This should be red.}
\textcolor{green}{This should be green.}

\color{black} Black.
{\color{blue} Blue.
{\color{cyan} Cyan.
{\color{magenta} Magenta.
{\color{yellow} Yellow.}
Back to Magenta.}
Back to Cyan.}
Back to Blue.}
Back to black.

\definecolor{ltgray}{gray}{0.8}
\definecolor{dkgray}{gray}{0.2}
\definecolor{purple}{rgb}{.5,0,.5}
\definecolor{weird1}{cmyk}{.5,.4,.3,.2}
\definecolor{weird2}{hsb}{.7,.8,.9}
{
\color{ltgray} Light gray.
\color{dkgray} Dark gray.
\color{purple} Purple.
\color{weird1} No idea what this color is!
\color{weird2} Nor this.
}

\colorbox{red}{Black text on a red background.}

\fcolorbox{red}{yellow}{Black text on a yellow background with red frame.}

{\raggedright\pretolerance=10000
Now let's test the use of color names defined in {\tt color.pro}:\\
\def\testcolor#1{\special{color push #1}#1\special{color pop}}
\testcolor{GreenYellow}
\testcolor{Yellow}
\testcolor{Goldenrod}
\testcolor{Dandelion}
\testcolor{Apricot}
\testcolor{Peach}
\testcolor{Melon}
\testcolor{YellowOrange}
\testcolor{Orange}
\testcolor{BurntOrange}
\testcolor{Bittersweet}
\testcolor{RedOrange}
\testcolor{Mahogany}
\testcolor{Maroon}
\testcolor{BrickRed}
\testcolor{Red}
\testcolor{OrangeRed}
\testcolor{RubineRed}
\testcolor{WildStrawberry}
\testcolor{Salmon}
\testcolor{CarnationPink}
\testcolor{Magenta}
\testcolor{VioletRed}
\testcolor{Rhodamine}
\testcolor{Mulberry}
\testcolor{RedViolet}
\testcolor{Fuchsia}
\testcolor{Lavender}
\testcolor{Thistle}
\testcolor{Orchid}
\testcolor{DarkOrchid}
\testcolor{Purple}
\testcolor{Plum}
\testcolor{Violet}
\testcolor{RoyalPurple}
\testcolor{BlueViolet}
\testcolor{Periwinkle}
\testcolor{CadetBlue}
\testcolor{CornflowerBlue}
\testcolor{MidnightBlue}
\testcolor{NavyBlue}
\testcolor{RoyalBlue}
\testcolor{Blue}
\testcolor{Cerulean}
\testcolor{Cyan}
\testcolor{ProcessBlue}
\testcolor{SkyBlue}
\testcolor{Turquoise}
\testcolor{TealBlue}
\testcolor{Aquamarine}
\testcolor{BlueGreen}
\testcolor{Emerald}
\testcolor{JungleGreen}
\testcolor{SeaGreen}
\testcolor{Green}
\testcolor{ForestGreen}
\testcolor{PineGreen}
\testcolor{LimeGreen}
\testcolor{YellowGreen}
\testcolor{SpringGreen}
\testcolor{OliveGreen}
\testcolor{RawSienna }
\testcolor{Sepia}
\testcolor{Brown}
\testcolor{Tan}
\testcolor{Gray}
\testcolor{Black}
\setbox0=\hbox{White}\rlap{\vrule height\ht0 width\wd0}%
\testcolor{White}
\par}

\color{blue}
The text on the rest of the page is blue (but not the page number).


\newpage

\section{Background tests}
\label{bg-sec}

\pagecolor{red}
\pagecolor{yellow}  % last one is obeyed
The background for this page should be yellow.

Text should still be blue.

\color{black} Back to black.

{\color{white} This text should be white.}


\newpage

The background should still be yellow.

This page is deliberately... \rlap{\hskip 6in ...off the paper.}

\newpage

\pagecolor{black}
\color{white}
The background is now black and the text is white.


\end{document}
% Comment out the above line to add a page with deliberate errors:

\newpage

\section{Bad syntax}

This page has html and color specials with deliberate errors.

\pagecolor{white}
\color{black}

\special{color black}       % global color when stack not empty

\special{html:x}            % missing <
\special{html: x}           % missing <
\special{html:<x}           % unexpected character
\special{html:<a xxx}       % missing href or name

\special{color }            % unexpected end
\special{color push}        % unexpected end
\special{color push gray x} % bad color value
\special{color rgb -1}      % bad color value
\special{color rgb 1 1}     % missing color value
\special{color hsb 1 1}     % missing color value
\special{color cmyk 1 1 1}  % missing color value
\special{color gray}        % missing color value
\special{color z}           % unknown keyword
\special{background zzz}    % unknown keyword

\end{document}
